<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src='https://unpkg.com/valine/dist/Valine.min.js'></script>
    <script language="javascript" type="text/javascript"
        src="https://cdn.staticfile.org/jquery/1.7.2/jquery.min.js"></script>

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css">
    <script src="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>
</head>

<body>
    <div>
        <input type="number" value="" id="year"><button onclick="runnian()">检测是否为闰年</button>
        <p id="demo"></p>
    </div>
    <div>
        <button onclick="zhishu()">质数</button>
    </div>
    <div>
        <input type="number" value="" id="money"><button onclick="geshui()">个税计算</button>

    </div>
    <div>
        <input type="text" value="" id="array">以逗号分隔输入数组
        <button onclick="paixu()">排序</button>
        <p id="show"></p>
    </div>
    <div>
        <input type="number" value="" id="num1">
        <input type="number" value="" id="num2">
        <button onclick="suanzhishu()">指数运算</button>
        <p id="suanzhishu"></p>
    </div>
    <div>
        <input type="number" value="" id="usermoney">

        <button onclick="autoshop()">售货机找零</button>
        <p id="shop"></p>
    </div>
    <div id="vcomments"></div>

    <!-- <div id="aplayer"></div> -->

    <!-- <div class="aplayer" data-id="60198" data-server="netease" data-type="playlist" data-fixed="true"></div> -->
    <meting-js
	server="netease"
	type="playlist"
    id="60198"
    fixed="true"
    >
</meting-js>
</body>


<script>
    // const ap = new APlayer({
    //     container: document.getElementById('aplayer'),
    //     fixed: true,
    //     audio: [{
    //         name: 'name',
    //         artist: 'artist',
    //         url: 'url.mp3',
    //         cover: 'cover.jpg',
    //     }]
    // });


    new Valine({
        el: '#vcomments',
        app_id: 'gEkw1BH5bgc0kh46jbqv5xnu-gzGzoHsz',
        app_key: 'b8oex60mxCMf4cm05bx4DGn6',
        notify: false,
        verify: false,
        avatar: 'mp',
        placeholder: 'HHHHH'
    });</script>

<script type="text/javascript">
    // 鼠标点击特效
    var mouseSum = 0;
    jQuery(document).ready(function ($) {
        $("body").click(function (e) {
            var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
            var $i = $("<span/>").text(a[mouseSum]);
            mouseSum = (mouseSum + 1) % a.length;
            var x = e.pageX,
                y = e.pageY;
            $i.css({
                "z-index": 9999999,
                "top": y - 20,
                "left": x,
                "position": "absolute",
                "font-weight": "bold",
                "color": "#6651ff"
            });
            $("body").append($i);
            $i.animate({
                "top": y - 180,
                "opacity": 0
            },
                1500,
                function () {
                    $i.remove();
                });
        });
    }); 
</script>


<script>







    function runnian(year) {
        var year = document.getElementById("year").value;
        if (!(year % 4) && (year % 100)) {
            document.getElementById("demo").innerHTML = year + '是闰年';
        } else {
            document.getElementById("demo").innerHTML = year + '不是闰年';
        }
    }

    function zhishu() {
        var b = [], j = 0;
        for (var num = 1; num < 1000; num++) {
            var count = 0;//统计因子个数
            for (let i = 1; i <= num; i++) {
                if (num % i == 0) {//因子
                    count++;
                    if (count > 2) {
                        i = num + 1;
                    }
                }
            }
            if (count == 2) {
                b[j] = num
                j++
            }
        }
        console.log(b)
    }

    function paixu() {
        var str = document.getElementById("array").value;
        var array = str.split(',');
        if (array.length == 1) {
            var array = str.split('，');
        }
        console.log(array)
        var temp = 0;
        for (let i = 0; i < array.length; i++) {
            for (let j = 0; j < array.length - i; j++) {
                if (array[j] > array[j + 1]) {
                    temp = array[j + 1];
                    array[j + 1] = array[j];
                    array[j] = temp;
                }
            }
        }
        console.log(array);
        document.getElementById("show").innerHTML = array;
    }

    function geshui() {
        var money = document.getElementById("money").value;
        let a = money - 3500
        console.log(a);
        if (a <= 0) {
            alert("您无需缴税");
        } else if (a > 0 && a <= 1500) {
            b = a * 0.03
            alert("您需要缴税" + b + "元");
        } else if (a > 1500 && a <= 4500) {
            b = a * 0.1 - 105
            alert("您需要缴税" + b + "元");
        } else if (a > 4500 && a <= 9000) {
            b = a * 0.2 - 555
            alert("您需要缴税" + b + "元");
        } else if (a > 9000 && a <= 35000) {
            b = a * 0.25 - 1005
            alert("您需要缴税" + b + "元");
        } else if (a > 35000 && a <= 55000) {
            b = a * 0.3 - 2755
            alert("您需要缴税" + b + "元");
        } else if (a > 55000 && a <= 80000) {
            b = a * 0.35 - 5505
            alert("您需要缴税" + b + "元");
        } else if (a > 80000) {
            b = a * 0.45 - 13505
            alert("您需要缴税" + b + "元");
        }
    }


    function suanzhishu() {
        var num1 = document.getElementById("num1").value;
        var num2 = document.getElementById("num2").value;
        let r = num1 ** num2;
        document.getElementById("suanzhishu").innerHTML = r;
        console.log(r)
    }

    function autoshop() {

        
        let money = document.getElementById("usermoney").value;
        let n20 = Math.floor(money / 20);
        let idx = money % 20;
        let n10 = Math.floor(idx / 10);
        idx = idx % 10;
        let n5 = Math.floor(idx / 5);
        idx = idx % 5;
        let n2 = Math.floor(idx / 2);
        idx = idx % 2;
        let n1 = idx;
        console.log(n20, n5, n2, n1)
        document.getElementById("shop").innerHTML = "找零" + n20 + '张20块 ' + n10 + '张10块 ' + n5 + '张5块  ' + n2 + '张2块  ' + n1 + '张1块  '

    }





</script>

</html>